package DuiXiang.src.Computer;

//磁盘
public class Disk {
    private String name;
    private double diskSize;
    private Software[] s = new Software[0];
    private int count = 0;
    private BitComet[] bi = new BitComet[0];
    private int countbi = 0;

    public Disk() {
    }

    public Disk(String name, double diskSize) {
        this.name = name;
        this.diskSize = diskSize;
    }

    //安装软件
    public void add(Software so) {
        if (count >= s.length) {
            Software[] sx = new Software[s.length + 1];
            for (int i = 0; i < count; i++)
                sx[i] = s[i];
            s = sx;
        }
        s[count++] = so;
    }

    public void showSoftware() {
        for (int i = 0; i < count; i++) {
            System.out.println(this.s[i].getName() + "  " + this.s[i].getMemory() + "M");
        }
    }

    public void addBitComet(BitComet so) {
        if (countbi >= bi.length) {
            BitComet[] bix = new BitComet[bi.length + 1];
            for (int i = 0; i < countbi; i++)
                bix[i] = bi[i];
            bi = bix;
        }
        bi[countbi++] = so;
    }
    public void showBitComet() {
        for (int i = 0; i < countbi; i++) {
            System.out.println(this.bi[i].getName() + "  " + this.bi[i].getMemory() + "M");
        }
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getDiskSize() {
        return diskSize;
    }

    public void setDiskSize(double diskSize) {
        this.diskSize = diskSize;
    }

    public Software[] getS() {
        return s;
    }

    public void setS(Software[] s) {
        this.s = s;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public BitComet[] getBi() {
        return bi;
    }

    public void setBi(BitComet[] bi) {
        this.bi = bi;
    }

    public int getCountbi() {
        return countbi;
    }

    public void setCountbi(int countbi) {
        this.countbi = countbi;
    }
}
